package org.trinity.netdisk.vo.allFile;

import org.trinity.netdisk.entity.File;
import org.trinity.netdisk.entity.UserFile;

public class FileVO extends UserFile {
    private Integer typeId;
    private Long size;
    //前端需要的一个标记位，不被理会
    private Object selected;

    public void setUserFile(UserFile userFile){
        this.setId(userFile.getId());
        this.setUserId(userFile.getUserId());
        this.setParentId(userFile.getParentId());
        this.setFileId(userFile.getFileId());
        this.setName(userFile.getName());
        this.setStatus(userFile.getStatus());
        this.setCreateTime(userFile.getCreateTime());
        this.setUpdateTime(userFile.getUpdateTime());
        this.typeId = userFile.getFile().getTypeId();
        this.size = userFile.getFile().getSize();
    }

    @Override
    public void setFile(File file){
        this.typeId = file.getTypeId();
        this.size = file.getSize();
    }

    @Override
    public String toString() {
        return "FileVO{" + super.toString() +
                ", typeId=" + typeId +
                ", size=" + size +
                '}';
    }

    public Integer getTypeId() {
        return typeId;
    }

    public Long getSize() {
        return size;
    }
}
